import request from '@/utils/request'
import { paramNoNull } from '@/utils/ParamFilter'

export function login(data) {
  return request({
    url: '/admin/login',
    method: 'post',
    params: data
  })
}

export function getUserInfo() {
  return request({
    url: '/admin/bee-manage/sys-user/getUserInfo',
    method: 'get'
  })
}

export function getMenuForButton() {
  return request({
    url: '/admin/bee-manage/sys-user/getMenuButton',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/admin/logout',
    method: 'post'
  })
}
export function page(data) {
  return request({
    url: '/admin/bee-manage/sys-user/page',
    method: 'get',
    params: paramNoNull(data)
  })
}
export function deleteById(id) {
  return request({
    url: '/admin/bee-manage/sys-user/' + id,
    method: 'delete'
  })
}
export function deleteByIds(ids) {
  return request({
    url: '/admin/bee-manage/sys-user/batch',
    method: 'post',
    data: ids
  })
}
export function recover(ids) {
  return request({
    url: '/admin/bee-manage/sys-user/recover',
    method: 'post',
    data: ids
  })
}
export function clear() {
  return request({
    url: '/admin/bee-manage/sys-user/clear',
    method: 'delete'
  })
}

export function editUser(data) {
  return request({
    url: '/admin/bee-manage/sys-user/edit',
    method: 'post',
    data: paramNoNull(data)
  })
}
export function changePassword(data) {
  return request({
    url: '/admin/bee-manage/sys-user/changePassword?password=' + data,
    method: 'post'
  })
}
export function addUser(data) {
  return request({
    url: '/admin/bee-manage/sys-user',
    method: 'post',
    data: paramNoNull(data)
  })
}

export function getDepartmentTree() {
  return request({
    url: '/admin/bee-manage/sys-user/getDepartmentTree',
    method: 'get'
  })
}

